
<template>
  <el-dialog v-model="commentTaskWinDialogVisible"

             width="50%"
              >

    <el-descriptions column="2" title="项目详情">
      <el-descriptions-item label="项目编号">{{project.projectStatus}}</el-descriptions-item>
      <el-descriptions-item label="项目名称">{{project.projectName}}</el-descriptions-item>
      <el-descriptions-item label="项目负责人">{{project.user.userName}}</el-descriptions-item>
      <el-descriptions-item label="开始时间">{{project.startTime}}</el-descriptions-item>
      <el-descriptions-item label="结束时间">{{project.endTime}}</el-descriptions-item>
      <el-descriptions-item label="项目描述">{{project.projectDesc}}</el-descriptions-item>

    </el-descriptions>



    <el-descriptions column="2" title="任务详情">
      <el-descriptions-item label="任务标题">{{tasks.taskTitle}}</el-descriptions-item>
      <el-descriptions-item label="任务简介">{{tasks.taskDesc}}</el-descriptions-item>
      <el-descriptions-item label="任务开始时间">{{tasks.startTime}}</el-descriptions-item>
      <el-descriptions-item label="任务结束时间">{{tasks.endTime}}</el-descriptions-item>
      <el-descriptions-item label="工期">{{tasks.taskDuration}}</el-descriptions-item>
      <el-descriptions-item label="进度">{{tasks.taskProgress}}</el-descriptions-item>
      <el-descriptions-item label="负责人">
        <template v-if="!tasks.user || tasks.user.userName == null">
          无
        </template>
        <template v-else>
          {{tasks.user.userName}}
        </template>
      </el-descriptions-item>

    </el-descriptions>
  </el-dialog>
</template>

<script setup>
import {ref, watch} from "vue";
const props = defineProps(['task'])
import taskRequest from "@/api/task.js";
import projectRequest from "@/api/projects.js";



//评论详情弹窗标记
let commentTaskWinDialogVisible = ref(false);


//存放当前任务的项目数据
let project = ref({user:{}})
function loadComment(){
  // taskRequest.loadTaskByUserId(props.task.,res=>{
  //   console.log(res)
  // })
  projectRequest.selectProjectByIdList(tasks.value.projectId,res=>{
    project.value = res.data;

  })
  commentTaskWinDialogVisible.value = true;
}


//存放当前行任务数据
let tasks = ref([])
watch(()=>props.task,()=>{
  tasks.value = props.task

  loadComment()
})

</script>

<style scoped>

</style>